package com.zecan.blog.dao.converter;

import com.zecan.blog.dto.atricle.ArticleDto;
import com.zecan.blog.entity.Article;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @ClassName BlogArticleConverter
 * @Description
 * @date 2022/11/5 16:55
 * @Version 1.0
 */
@Mapper
public interface BlogArticleConverter {

    // 获取实例
    BlogArticleConverter INSTANCE = Mappers.getMapper(BlogArticleConverter.class);


    @Mappings({
            @Mapping(target = "articleTitle",source = "title"),
            @Mapping(target = "articleClassify",source = "classify"),
            @Mapping(target = "articleDescription",source = "description"),
            @Mapping(target = "articleContent",source = "content"),
            @Mapping(target = "articleImage",source = "articleImagUrl"),
            @Mapping(target = "articleTag",source = "tag"),
            @Mapping(target = "articleId",source = "articleId"),
    })
    Article articleConvertEntity(ArticleDto articleDto);
}
